<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
//Includes
use_unit("components4phpfull/jtsitetheme.inc.php");
use_unit("platinumgrid/jtplatinumgrid.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class Labor_Endo extends Page
{
       public $JTMiscEndorsement = null;
       public $hiddenMisc = null;
       public $Image1 = null;
       public $hiddenWO = null;
       public $hiddenVeh = null;
       public $JTSiteTheme1 = null;
       function JTMiscEndorsementShow($sender, $params)
       {
       $query1 = "select * from endorsement_misc_tbl where veh_id='".$this->hiddenVeh->getValue()."' and wo_id='".$this->hiddenWO->getValue()."' and misc_id='".$this->hiddenMisc->getValue()."' order by date DESC";
       $result = mysql_query($query1)or die(mysql_error());

       $arr = array();
       while($row = mysql_fetch_array($result))
       {

       $arr[] = array(
                        'Date' => $row['date'],
                        'Reason' => $row['reason'],
                        'Endorsed by' => $row['endorsed_by']
                        );
       }

       $this->JTMiscEndorsement->setCellData($arr);

       }


       function Labor_EndoJSLoad($sender, $params)
       {

       ?>
       //Add your javascript code here
       var veh = document.getElementById("hiddenVeh").value;
       var wo = document.getElementById("hiddenWO").value;
       var labor = document.getElementById("hiddenLabor").value;
       alert(veh+wo+labor);
       <?php

       }

       function Labor_EndoCreate($sender, $params)
       {
       $veh = $_GET['veh'];
       $wo = $_GET['WO'];
       $misc = $_GET['misc'];
       $this->hiddenVeh->setValue($veh);
       $this->hiddenWO->setValue($wo);
       $this->hiddenMisc->setValue($misc);


       }


}

global $application;

global $Labor_Endo;

//Creates the form
$Labor_Endo=new Labor_Endo($application);

//Read from resource file
$Labor_Endo->loadResource(__FILE__);

//Shows the form
$Labor_Endo->show();

?>